import Echo from './Plugin.ts'
import { encrypt } from './aes'
import { jiami, jiemi } from "../utils/aeskey";
// const res = {
//     GAID: "7d34badb-026e-4c87-90f3-8b7a0b07b0e7",
//     AID: "7bfc1650648907b3",
//     RV: "1.0",
//     VERSION: "1.0.0",
// }
// console.log(JSON.stringify(res))
export async function getAndroid() {
    const { gaId, androidId, appVersionName } = await Echo.echo({ m: 'getHeader' });
    console.log(' GAID, AID, VERSION', gaId, androidId, appVersionName);
    // const str = 'GHTQZ5OZ' + encrypt(JSON.stringify({
    //     GAID: gaId,
    //     AID: androidId,
    //     RV: appVersionName,
    //     VERSION: '1.0.0'
    // }), null)
    const str = 'GHTQZ5OZ' +
        (jiami({
            GAID: gaId,
            AID: androidId,
            RV: appVersionName,
            VERSION: '1.0.0'
        }))
    return str
}
export async function geta() {
    const ret = await Echo.echo({ m: 'requestPermission' });
    // console.log(JSON.stringify(ret), 'ret')
    return ret
}

//上报信息
// export async function getGoogleToken() {
//     const ret = await Echo.echo({ m: 'getGoogToken' });
//     return ret
// }
// export async function getInstanceId() {
//     const ret = await Echo.echo({ m: 'getInstanceId' });
//     return ret
// }
// export async function initInstallReferrer() {
//     const ret = await Echo.echo({ m: 'initInstallReferrer' });
//     return ret
// }